package com.cheche.dn.domain;

import com.cheche.dn.Result;
import com.cheche.dn.common.Filter;
import com.cheche.dn.common.base.BaseController;
import com.cheche.dn.domain.user.User;
import com.cheche.dn.domain.user.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by cheshun on 15/11/13.
 */
@RestController
public class TestController extends BaseController {

    @Autowired
    private UserService userService;

    @RequestMapping(TEST_URL)
    public Object test(@RequestParam String name) {
        User user = service.find(User.class, Filter.eq(User.USERNAME_PROPERTY_NAME, "test0000"));
        user.setNickname(name);
        userService.test(user);
        return Result.success();
    }
}
